// 引入mongoose
const mongoose = require("mongoose");
const { users } = require("./data/users.js");
// 创建模型
const usersScheme = new mongoose.Schema({
  username: String,
  password: String,
});
const usersModel = mongoose.model("users", usersScheme, "users");

mongoose.connect(
  "mongodb://tangzhenhua:Lovo123456@182.92.214.223:8084/maiwenjie-project",
  {
    useNewUrlParser: true,
    useUnifiedTopology: true,
    auth: { authSource: "admin" },
  },
  async () => {
    // 当连接成功后触发
    // 创建电影数据 一个（对象）或多个（数组）
    await usersModel.create(users);

    // console.log(122);
  }
);
